<!-- 文章列表 -->
<div id="post">
    <div id="detail">
        <h1>{$row.title}</h1>
        <div class="post-meta"><a href="{:url('category/index',['id'=>$row.category_id])}">{$row.category.name}</a> |
            发布于:{$row.created}| <a href="#comments">{$row.click_count}人读过</a></div>
        <div class="post-content">
            {$row.content.content}
        </div>
    </div>
    <div id="comments">
        <h3><span id="commentcount">{$comments->total()}</span> 条评论</h3>
        <div class="commentlist">
            {foreach $comments as $comment}
            <dl id="comment-133">
                <dt><img alt=""
                         src="https://secure.gravatar.com/avatar/d41d8cd98f00b204e9800998ecf8427e?s=48&amp;d=&amp;r=X"
                         class="avatar"></dt>
                <dd>
                    <div class="parent">
                        <cite><a href="" rel="external nofollow" class="url"
                                 target="_blank">{$comment.username}</a></cite>
                        <small> {$comment.created} <a href="javascript:;" rel="133" title="" class="reply"
                                                      style="display: inline;">回复TA</a></small>
                        <p>{$comment.content}</p>
                    </div>
                </dd>
                <div class="clearfix"></div>
            </dl>
            {/foreach}
            <div class="pager">
                {$comments->render()}
            </div>
        </div>
    </div>
    <!-- 下一篇 -->
    <div class="next-post ta-c">
        <p>当前已经是最新一篇日志</p>
    </div>
    <div id="respond">
        <h3>留下评论 <a href="javascript:;">取消回复</a></h3>
        <form action="" method="post" id="postform">
            {:token()}
            <input type="hidden" name="post_id" id="post_id" value="{$row.id}">
            <p><input type="text" class="input" name="username" id="username" value="" size="22" tabindex="1">
                <label for="username">
                    <small>名称 (必须)</small>
                </label></p>
            <p><input type="text" class="input" name="email" id="email" value="" size="22" tabindex="2">
                <label for="email">
                    <small>邮件地址 (不会被公开) (必须)</small>
                </label></p>
            <p><input type="text" class="input" name="website" id="website" value="" size="22" tabindex="3">
                <label for="url">
                    <small>网站或博客</small>
                </label></p>
            <p><textarea name="content" class="input" id="commentcontent" cols="6" rows="5" tabindex="4"></textarea></p>
            <p><input name="submit" type="submit" id="submit" tabindex="5" value="提交评论(Ctrl+回车)"
                      class="btn btn-primary"><span id="actiontips"></span></p>
            <div class="clearfix"></div>
            <div class="clearfix"></div>
        </form>
    </div>
</div>
<script>
    layui.use('layer',function(){
        var layer=layui.layer;
        $('#postform').submit(function(e){
            e.stopPropagation();
            e.preventDefault();
            $.post('{:url("comments/add")}',$(e.target).serialize(),function(response){
                layer.msg(response.msg,{icon:2});
                if(response.code==0){
                    window.location.reload();
                }
            })
        });
    });
</script>

